package com.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.blog.pojo.Collection;
import com.blog.service.CollectionService;
import com.blog.mapper.CollectionMapper;
import org.springframework.stereotype.Service;

/**
* @author DELL
* @description 针对表【t_collection】的数据库操作Service实现
* @createDate 2022-07-14 19:42:19
*/
@Service
public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collection>
    implements CollectionService{

    /**
     * 统计博客的收藏量
     * @param blogId 博客id
     * @return Integer
     */
    @Override
    public Integer countTheBlogCollection(Long blogId) {
        LambdaQueryWrapper<Collection> collectionLambdaQueryWrapper = new LambdaQueryWrapper<>();
        collectionLambdaQueryWrapper.eq(Collection::getBlogId,blogId);
        return this.count(collectionLambdaQueryWrapper);
    }
}




